線形回帰のパラメータの推定
平均値のパラメータの推定
具体的な値は,参考にしたサイトの値を使わさせていただきます.
i | x | y |
1 | 0 | 5 |
2 | 2 | 5 |
3 | 3 | 7 |
4 | 4 | 6 |
5 | 6 | 9 |
6 | 9 | 10 |
エクセルで散布図,近似曲線を描くと,
となります.
前頁の計算を行って見ると,推定値は,
i | x | y | x2 | xy |
1 | 0 | 5 | 0 | 0 |
2 | 2 | 5 | 4 | 10 |
3 | 3 | 7 | 9 | 21 |
4 | 4 | 6 | 16 | 24 |
5 | 6 | 9 | 36 | 54 |
6 | 9 | 10 | 81 | 90 |
平均 | 4 | 7 | 24.33 | 33.17 |
和 | 24 | 42 | 146 | 199 |
平方和 | 146 | 316 | 8210 | 12133 |
\(\Large\displaystyle \hat{a_1} = \frac{ \overline{x y} - \bar{x} \bar{y} }
{ \displaystyle
\overline{x^2}- \bar{x}^2}
= \frac{ 33.17 - 4 \times 7}
{ 24.33- 4^2} = 0.62
\)
\(\Large\displaystyle \hat{a_0} = \bar{y} - \frac{ \overline{x y} - \bar{x} \bar{y} }
{ \displaystyle
\overline{x^2}- \bar{x}^2}
\bar{x}
= 7-0.62 \times 4
= 4.52 \)
となり,エクセルの近似結果と一致します.
分散値,標準誤差は,
i | x | y | x2 | xy | \( x - \bar{x} \) | \( \hat{y} \) | \( y-\hat{y} \) |
1 | 0 | 5 | 0 | 0 | -4 | 4.52 | 0.48 |
2 | 2 | 5 | 4 | 10 | -2 | 5.76 | -0.76 |
3 | 3 | 7 | 9 | 21 | -1 | 6.38 | 0.62 |
4 | 4 | 6 | 16 | 24 | 0 | 7.00 | -1 |
5 | 6 | 9 | 36 | 54 | 2 | 8.24 | 0.76 |
6 | 9 | 10 | 81 | 90 | 5 | 10.1 | -0.1 |
平均 | 4 | 7 | 24.33 | 33.17 | |||
和 | 24 | 42 | 146 | 199 | |||
Se(二乗和) | 146 | 316 | 8210 | 12133 | 50 | 2.78 | |
Ve(分散) | 0.695 |
\(\Large \displaystyle V \left[\hat{a_1} \right]
= \frac{\sigma^2 }{ \displaystyle
\sum_{i=1}^{n} \left( x_i - \bar{x} \right)^2}
=
\frac{ \frac{2.78}{4} }{50} = 0.0139 \)
\(\Large \displaystyle SE[\hat{a_1} ] =\sqrt{V \left[\hat{a_1} \right]} = 0.117898 \)
\(\Large \displaystyle
V \left[ \hat{a_0} \right] = \sigma^2 \frac{ \displaystyle
\sum_{i=1}^{n} x_i^2 }{n \displaystyle
\sum_{i=1}^{n} \left( x_i - \bar{x} \right)^2}
=
\frac{ \frac{2.78}{4} \times146}{6 \times 50} = 0.338233 \)
\(\Large \displaystyle SE[\hat{a_0} ] =\sqrt{V \left[\hat{a_0} \right]} =0.581578 \)
となり,エクセルの”データ分析”,”回帰分析”の結果,
係数 | 標準誤差 | |
切片 | 4.52 | 0.581578 |
x 値 1 | 0.62 | 0.117898 |
と一致します.
また,ここで重要なのが,Se, Veです.
・推定値からの残差
\(\Large \displaystyle Se = \sum_{i=1}^{n} \left( y_i -\hat{a_0} - \hat{a_1} x_i \right)^2 = 2.78 \)
・分散
\(\Large \displaystyle Ve = \frac{1}{n-2} \sum_{i=1}^{n} \left(y_i -\hat{a_0} - \hat{a_1} x_i \right)^2 = \frac{Se}{n-2} = \frac{2.78}{6-2} = 0.695 \)
です(a0,a1,の二つのパラメータが2つあるので,自由度は,n-2).
これが後々重要となってきます.
では,次に,
傾き,a1,をシフト
させてみましょう.